package com.browsesoft.htmlcomponent;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * HTML模型, 负责提供和修改数据
 */
public interface HTMLBasicModel {
	/**
	 * 初始化model
	 */
	public void init(HttpServletRequest request) throws Exception;

	/**
	 * 处理用户请求
	 * 
	 * @param request
	 *            客户端请求
	 */
	public void service(HttpServletRequest request, HttpServletResponse response)
			throws Exception;

	/**
	 * 设置模型所对应的组件
	 * 
	 * @param component
	 *            对应的组件
	 */
	public void setComponent(HTMLBasicComponent component);

	/**
	 * 由Component决定需要Model处理的元素内容，在Component的updateElement()方法中调用
	 */
	public void updatePageElement(HTMLBasicComponent c) throws Exception;
}
